#ifndef __FLOAT_H__
#define __FLOAT_H__

#include "trap.h"

typedef int FLOAT;

//注意这里，所谓的int和FLOAT的转换，int代表的是一个实数，如int a=2,而我们要考虑如何把实数2转换为FLOAT，即把2乘上2^16

static inline int F2int(FLOAT a) // a/2^16即可
{
	return (a >> 16);
}

static inline FLOAT int2F(int a) // a*2^16即可
{
	return (a << 16);
}

static inline FLOAT F_mul_int(FLOAT a, int b)
{
	return a * b;
}

static inline FLOAT F_div_int(FLOAT a, int b)
{
	return a / b;
}

FLOAT f2F(float);
FLOAT F_mul_F(FLOAT, FLOAT);
FLOAT F_div_F(FLOAT, FLOAT);
FLOAT Fabs(FLOAT);
FLOAT sqrt(FLOAT);
FLOAT pow(FLOAT, FLOAT);

// used when calling printf/sprintf to format a FLOAT argument
#define FLOAT_ARG(f) (long long)f

void init_FLOAT_vfprintf(void);

#endif
